import 'package:flutter/material.dart';
import 'package:flutter_application_1/pages/MyDialog.dart';
import '../MyDialog.dart';

class HomePage extends StatefulWidget {
  HomePage({Key key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Column(
      // crossAxisAlignment: CrossAxisAlignment.start,
      // mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Row(
          children: <Widget>[
            RaisedButton(
                child: Text("跳到搜索页"),
                onPressed: () {
                  // 路由跳转
                  // Navigator.of(context).push(
                  //   MaterialPageRoute(
                  //     builder: (context)=>SearchPage()
                  //   )
                  // );

                  // Navigator.pushNamed(context, '/search');

                  // 03
                  Navigator.pushNamed(context, '/search',
                      arguments: {'id': 123});
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("跳到产品页"),
                onPressed: () {
                  Navigator.pushNamed(context, '/product');
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("跳到AppBar"),
                onPressed: () {
                  Navigator.pushNamed(context, '/appBarDemo');
                }),
          ],
        ),
        RaisedButton(
            child: Text("跳到AppBarSecond"),
            onPressed: () {
              Navigator.pushNamed(context, '/appBarDemoSecond');
            }),
        RaisedButton(
            child: Text("TabBarController定义顶部tab切换"),
            onPressed: () {
              Navigator.pushNamed(context, '/tabBarController');
            }),
        RaisedButton(
            child: Text("按钮"),
            onPressed: () {
              Navigator.pushNamed(context, '/button');
            }),
        Row(
          children: <Widget>[
            RaisedButton(
                child: Text("datePicker"),
                onPressed: () {
                  Navigator.pushNamed(context, '/datePicker');
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("datePickerPub"),
                onPressed: () {
                  Navigator.pushNamed(context, '/datePickerPub');
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("swiper"),
                onPressed: () {
                  Navigator.pushNamed(context, '/swiper');
                }),
          ],
        ),
        Row(
          children: <Widget>[
            RaisedButton(
                child: Text("Dialog"),
                onPressed: () {
                  Navigator.pushNamed(context, '/dialog');
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("自定义dialog组件"),
                onPressed: () {
                  showDialog(
                      context: context,
                      builder: (context) {
                        return MyDialogPage(title: '关于我们', content: '内容！');
                      });
                }),
            SizedBox(width: 10),
            RaisedButton(
                child: Text("data"),
                onPressed: () {
                  Navigator.pushNamed(context, '/data');
                }),
          ],
        ),
        Row(children: <Widget>[
          RaisedButton(
              child: Text("http"),
              onPressed: () {
                Navigator.pushNamed(context, '/http');
              }),
          SizedBox(width: 10),
          RaisedButton(
              child: Text("dio"),
              onPressed: () {
                Navigator.pushNamed(context, '/dio');
              }),
          SizedBox(width: 10),
          RaisedButton(
              child: Text("临时按钮"),
              onPressed: () {
                Navigator.pushNamed(context, '/textField');
              }),
        ])
      ],
    );
  }
}
